/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.vivo.dealer.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.service.TreeService;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.vivo.dealer.entity.VivoDealerRelation;
import com.vivo.dealer.dao.VivoDealerRelationDao;

/**
 * 经销商关系Service
 * @author jyangye
 * @version 2017-11-08
 */
@Service
@Transactional(readOnly = true)
public class VivoDealerRelationService extends TreeService<VivoDealerRelationDao, VivoDealerRelation> {
    @Autowired
    private VivoDealerRelationDao vivoDealerRelationDao;

	public VivoDealerRelation get(String id) {
		return super.get(id);
	}

	public VivoDealerRelation get(VivoDealerRelation vivoDealerRelation) {
		return super.get(vivoDealerRelation);
	}

	public VivoDealerRelation getPE(VivoDealerRelation vivoDealerRelation) {
	    return vivoDealerRelationDao.getPE(vivoDealerRelation);
    }
	
	public List<VivoDealerRelation> findList(VivoDealerRelation vivoDealerRelation) {
		if (StringUtils.isNotBlank(vivoDealerRelation.getParentIds())){
			vivoDealerRelation.setParentIds(","+vivoDealerRelation.getParentIds()+",");
		}
		return super.findList(vivoDealerRelation);
	}
	
	@Transactional(readOnly = false)
	public void save(VivoDealerRelation vivoDealerRelation) {
		super.save(vivoDealerRelation);
	}
	
	@Transactional(readOnly = false)
	public void delete(VivoDealerRelation vivoDealerRelation) {
		super.delete(vivoDealerRelation);
	}

	@Transactional(readOnly = false)
	public void deleteAll(VivoDealerRelation vivoDealerRelation) {
		vivoDealerRelationDao.deleteAll(vivoDealerRelation);
	}

}